<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <title>JS运行机制</title>
</head>
<body>


<script>
    /*    console.log(1);
     setTimeout(function(){
     console.log(2)
     },0);
     console.log(3);*/


/*    console.log('A');

    setTimeout(function(){
        console.log('B')
    },0)

    while (true) {

    }*/


    for(var i =0 ;i<4;i++){
        setTimeout(function(){
            console.log(i)
        },1000)
    }

</script>
</body>
</html>